# include<stdio.h> 
# include <math.h>

void printN (int N){
	int i = 1;
	for ( i = 1; i<= N;i++){
		printf ("%d\n",i);
	}
}
void printn (int N){
	if (N){
		printn(N-1);
		printf("%d\n",N);
	}
	
} 
double multinomial (int n ,int a[],double x)
{
	int p = a[0];
	int together = 0;
	int i = 0;
	for ( i = 0;i< n;i++){
		together += a[i]*pow(x,i);	
	}
	return together;
}
double multinomials (int n ,int a[],double x)
{
	int p = a[n];
	int together = 0;
	int i = 0;
	for ( i = n;i>0;i--){
		together = a[i-1] + together*x;
	}
	return together;
}
int main (void)
{
//	int n = 100000;
//	printN (n);
//	printn(n);
	int a[] = {1,2,3,4};
	int number = multinomials(4,a,2);
	printf("%d",number);
	return 0;
}
